home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / xlib.zip / XSCRSAV.DOC < prev    next >
Text File  |  1992-09-05  |  3KB  |  95 lines

  1.  
  2.                                 XScrSav
  3.                                 -------
  4.  
  5. Here you have a screen-saver that you can use in you Turbo-Vision
  6. programs. It acts like the one in the Norton-Commander. For link
  7. it to your program you must make following in a TApplication
  8. descendant:
  9.  
  10.   TMyApplication = object( TApplication )
  11.     Saver : PScreenSaver;
  12.     constructor Init;
  13.     procedure   GetEvent(var Event:TEvent); virtual;
  14.   end;
  15.  
  16.   constructor TMyApplication.Init;
  17.   begin
  18.     TApplication.Init;
  19.     New( Saver, Init( 5 * 60 ));  (* equal to five minutes ! *)
  20.     Insert( Saver );
  21.   end;
  22.  
  23.   procedure  TMyApplication.GetEvent( var Event:TEvent );
  24.   begin
  25.     TApplication.GetEvent(Event);
  26.     Saver^.GetEvent(Event);
  27.   end;
  28.  
  29. Thats all you must do. After that check if the saver would be
  30. activate if you move the mouse-cursor to the upper-right corner.
  31.  
  32.  
  33. TScreenSaver
  34. ~~~~~~~~~~~~
  35.  
  36. This is the object that control the entire screen-saver.
  37.  
  38.  Fields:
  39.  -------
  40.  Activ     : Boolean   Indicate if the saver is activ
  41.  MaxSecs   : Word      Number of seconds after that the saver should
  42.                        be activate
  43.  SecsGone  : Word      Seconds that are gone without any events
  44.  MyView    : PView     The View which hold the active part of the
  45.                        screen saver module.
  46.  
  47.  Methods
  48.  -------
  49.  constructor Init( Ticks:word );
  50.    Initialize the screen-saver with the specified number of ticks.
  51.    The position of this invisble view is the upper-right corner.
  52.    By use the Move method of TView you can place it at an other
  53.    position.
  54.  
  55.  procedure GetEvent(var Event:TEvent); virtual;
  56.    All Events of the main application should be reported to this
  57.    method, because here is the part were the screen-saver look
  58.    for his activate timing
  59.  
  60.  function InitSaverView:PView; virtual;
  61.    This function would be use to activate the saver. On default it
  62.    return a norton-commander like screen-saver, but you can use
  63.    this method to install your own modules in it. A view descendant
  64.    that returned to this function, should be use the whole desktop
  65.    aera, and get total control over the handle event method. After
  66.    any event occured and catched by the GetEvent method the
  67.    View was deleted and the original screen would be redrawn
  68.  
  69.  
  70. Here some tips how the inside views for the norton-commander
  71. like screen-saver looks like :
  72.  
  73.      PStar = ^TStar;
  74.      TStar = object ( TView )
  75.        StarState : byte;
  76.        constructor Init( R:TRect);
  77.        procedure   Draw; virtual;
  78.        procedure   HandleEvent( var Event:TEvent ); virtual;
  79.      end;
  80.  
  81.      PSaverView  = ^TSaverView;
  82.      TSaverView  = object ( TGroup )
  83.        constructor Init;
  84.        procedure   HandleEvent( var Event:TEvent ); virtual;
  85.        procedure   Draw; virtual;
  86.      end;
  87.  
  88. The full method code was included in the registriated version.
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.